import request from '@/utils/request'
import { reqBaseData } from "@/api/type";

export enum USER_API {
  USER_AVATAR_URL = '/system/user/profile/avatar',
  USER_PROFILE_URL = '/system/user/profile',
  USER_UPDATE_PASSWORD = '/system/user/updateUserPwd',
}


export function login(data) {
  return request({
    url: '/vue-element-perfect/user/login',
    method: 'post',
    data,
  })
}


export function reqUserProfileAvatar(data) {
  return request({
    url: USER_API.USER_AVATAR_URL,
    method: 'post',
    data: data,
  })
}


// 修改用户个人信息
export function reqUpdateUserProfile(data) {
  return request({
    url: USER_API.USER_PROFILE_URL,
    method: 'put',
    data: data
  })
}

// 修改用户密码
export const reqUpdateUserPassword = (data) => {
  return request<any, reqBaseData>({
    url: USER_API.USER_UPDATE_PASSWORD,
    method: 'put',
    data: data,
  })
}
